/*
Copyright (C) 2022-2024 Inspur Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/
package controller

import (
	"did-service/common/constant"
	"did-service/common/logger"
	"did-service/common/rdb"
	"did-service/service"
	"time"
)

var log = logger.GetLogger("did.controller")

type DidController struct {
	srv      *service.DidService
	lockTool *rdb.LockTool
}

func NewDidController(srv *service.DidService) *DidController {
	return &DidController{
		srv:      srv,
		lockTool: rdb.NewLockTool(),
	}
}

func parseTime(timeStr string) (time.Time, error) {
	layout := constant.TimeLayout
	t, err := time.Parse(layout, timeStr)
	if err != nil {
		return time.Time{}, err
	}
	return t, nil
}
